package com.api.invitation.sendexternalcontactinvitation;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IInvitationApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/invitation/invitation-context.xml" })
public class SendExternalContactInvitation extends AbstractApiTest {

	@Value("#{org_invitations[toInvite].appId}")
	private String userId;

	@Value("#{org_invitations[toInvite].password}")
	private String userPassword;

	@Value("#{org_invitations[external].appId}")
	private String userToInvite;

	@BeforeClass
	public void setUpVariables() {

		getApi().login(userId, userPassword);
	}

	@Test(expectedExceptions = ZyncroApiException.class)
	public synchronized void testSendInvitation() throws ZyncroApiException {
		String comment = "comentario";

		getApi().getService(IInvitationApiService.class).sendExternalContactInvitation(userToInvite, comment);
	}
}
